<template>
    <div>
      <el-form ref="form" :model="form" label-width="80px">
        <el-form-item label="商品编号">
          <el-input v-model="form.goodsNo" @blur="checkGoodsNo()"></el-input>
        </el-form-item>
<!--        <el-form-item label="活动区域">-->
<!--          <el-select v-model="form.region" placeholder="请选择活动区域">-->
<!--            <el-option label="区域一" value="shanghai"></el-option>-->
<!--            <el-option label="区域二" value="beijing"></el-option>-->
<!--          </el-select>-->
<!--        </el-form-item>-->


        <el-form-item>
          <el-button type="primary" @click="onSubmit">立即创建</el-button>
          <el-button>取消</el-button>
        </el-form-item>
      </el-form>
    </div>
</template>

<script>
export default {
  name: "GoodsAdd",
  data() {
    return {
      form: {}
    }
  },
  methods: {
    onSubmit() {
      console.log('submit!');
    },
    checkGoodsNo:function (){
      this.$http.get("/goods/chekcGoodsNo/"+this.form.goodsNo).then((resp)=>{
        if (resp.data.code == 40000){
          this.$message.success("编号可以");
        }else{
          this.$message.error("编号重复，请重新填写");
          this.form.goodsNo = "";
        }
      })
    }
  }

}
</script>

<style scoped>

</style>
